22 template <class T
> string
toStr(const T
&x
){ stringstream s
; s
<< x
; return s
.str(); }
23 template <class T
> int toInt(const T
&x
){ stringstream s
; s
<< x
; int r
; s
>> r
; return r
; }
25 #define For(i, a, b) for (int i=(a); i<(b); ++i)
26 #define foreach(x, v) for (typeof (v).begin() x = (v).begin(); x != (v).end(); ++x)
27 #define D(x) cout << #x " is " << x << endl
29 const int MAXN
= 505, oo
= 1000000000;
41 while (getline(cin
, s
) && s
!= ""){
44 stringstream
sin(input
);
61 while (sin
>> u
>> v
>> w
){
63 g
[u
][v
] = min(g
[u
][v
], w
);
64 g
[v
][u
] = min(g
[v
][u
], w
);
70 g
[i
][j
] = min(g
[i
][j
], g
[i
][k
] + g
[k
][j
]);
78 printf("%d ", g[i][j]);
84 int which
= 0, howmuch
= oo
;
86 if (fire
[i
]) continue;
87 //printf("trying to place a station at %d\n", i);
94 cur
= min(cur
, g
[j
][k
]);
97 //printf(" closest station from node %d is at %d\n", j, cur);
98 distance
= max(distance
, cur
);
100 if (distance
< howmuch
){
106 cout
<< which
+ 1 << endl
;
107 if (casos
> 0) cout
<< endl
;